﻿<UserControl x:Class="LayoutPlanning.Views.ConfigWorkTaskView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:local="clr-namespace:LayoutPlanning.Views"
             xmlns:pt="http://propertytools.org/wpf"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300" >
    <StackPanel d:DataContext="{Binding Main.NewTask ,Source={StaticResource Locator}}">

        <StackPanel Visibility="{Binding  TaskType,  Converter={StaticResource TaskTypeToVisability}, TargetNullValue={x:Static Visibility.Collapsed}, ConverterParameter=Walk, FallbackValue={x:Static Visibility.Collapsed}}" >
            <StackPanel>
                <TextBox Text="{Binding TaskName}" />
                <TextBlock Text="Walk From" />
                <ComboBox DisplayMemberPath="Name"  ItemsSource="{Binding Main.DeployedStoragesMachines, Source={StaticResource Locator}}" SelectedValue="{Binding TaskFromStation}"/>
                <ComboBox DisplayMemberPath="Name"  ItemsSource="{Binding TaskFromStation.WorkPositions}" SelectedValue="{Binding TaskFromWorkPosition}"/>
                <TextBlock Text="To" />
                <ComboBox DisplayMemberPath="Name" ItemsSource="{Binding Main.DeployedStoragesMachines, Source={StaticResource Locator}}" SelectedValue="{Binding TaskToStation}"/>
                <ComboBox DisplayMemberPath="Name"  ItemsSource="{Binding TaskToStation.WorkPositions}" SelectedValue="{Binding TaskToWorkPosition}"/>
            </StackPanel>
            </StackPanel>
        <StackPanel Visibility="{Binding TaskType,  Converter={StaticResource TaskTypeToVisability}, TargetNullValue={x:Static Visibility.Collapsed}, ConverterParameter=Work, FallbackValue={x:Static Visibility.Collapsed}}">
                <TextBox Text="{Binding TaskName}" />
            <StackPanel>
                    <StackPanel Orientation="Vertical">
                        <Label Content="Work at" />
                    
                        
                    <ComboBox DisplayMemberPath="Name"  ItemsSource="{Binding Main.DeployedStoragesMachines, Source={StaticResource Locator}}" SelectedValue="{Binding TaskFromStation}"/>
                    <ComboBox DisplayMemberPath="Name"  ItemsSource="{Binding TaskFromStation.WorkPositions}" SelectedValue="{Binding TaskFromWorkPosition}"/>
                    </StackPanel>
                        <StackPanel Orientation="Horizontal">
                        <Label Content="For " />
                    <pt:SpinControl   Value="{Binding TaskTime, Converter={StaticResource TimeSpanToSeconds}}" Maximum="100000" Minimum="0"  SmallChange="1"   >
                        <TextBox Text="{Binding TaskTime, StringFormat={}{0:hh}:{0:mm}:{0:ss}}" BorderThickness="0" HorizontalContentAlignment="Right"/>
                    </pt:SpinControl>
                    
                    </StackPanel>
                    
                </StackPanel>
            </StackPanel>
        <StackPanel Visibility="{Binding TaskType, ConverterParameter=Carry, TargetNullValue={x:Static Visibility.Collapsed}, Converter={StaticResource TaskTypeToVisability}, FallbackValue={x:Static Visibility.Collapsed}}">

                <TextBox Text="{Binding TaskName}" />
            <StackPanel>
                    <StackPanel Orientation="Horizontal">
                        <Label Content="Carry" />
                        
                        <Label Content="from" />
                    </StackPanel>
                <ComboBox DisplayMemberPath="Name" ItemsSource="{Binding Main.DeployedStoragesMachines, Source={StaticResource Locator}}" SelectedValue="{Binding TaskFromStation}" />
                <ComboBox DisplayMemberPath="Name" ItemsSource="{Binding TaskFromStation.Products}" SelectedValue="{Binding TaskCarryObject}" />
                <Label Content="To" />
                <ComboBox  DisplayMemberPath="Name" ItemsSource="{Binding Main.DeployedStoragesMachines, Source={StaticResource Locator}}" SelectedValue="{Binding TaskToStation}" />
            </StackPanel>
            

            
        </StackPanel>
    </StackPanel>
       

</UserControl>
